﻿@model SysSetViewModel
@{
    ViewBag.Title = "系统设置";
    Layout = "~/Areas/Backend/Views/Shared/_Form.cshtml";
}

@section crumbs{
    <label class="backend-crumbs-separator">/</label>
    <a href="#" title="系统管理">系统管理</a>
    <label class="backend-crumbs-separator">/</label>
    <a href="#" title="系统设置">系统设置</a>
    <label class="backend-crumbs-separator">/</label>
    <a href="#" title="更新设置">更新设置</a>
}

@section beginForm{@{ Html.BeginForm("Update", "SysSet", FormMethod.Post, new { @class = "monk-form" });}}

<div class="monk-form-item">
    <label for="Logo" class="monk-form-label">系统标志</label>
    <div class="monk-form-wrap noborder">
        <img src="@Model.Logo" id="image-view" alt="" class="display-block" height="50" />
        @Html.HiddenFor(u => u.Logo)
    </div>
    <div class="clear-both height-8"></div>
    <div class="monk-form-wrap monk-form-image-wrap">
        <div class="monk-images-selects">
        </div>
        <div class="monk-form-wrap bgcolor-white">
            <span class="monk-iconfont border-right icon-monk-input"></span>
            <input class="monk-form-input normal" value="未选择文件" id="uploadUrl" readonly="readonly" data-src="@Model.Logo" />
            <span class="monk-iconfont border-left icon-monk-dacha" id="removeFile"></span>
        </div>
        <div class="monk-input-button monk-input-file" id="selectFiles">选择图片</div>
        <div class="monk-file-uploadProgress" id="uploadProgress"></div>
        <div class="monk-input-button emerland" id="startUpload">开始上传</div>
        <div class="monk-input-button amethyst" id="clearUpload" disabled="disabled">重置删除</div>
    </div>
    <div class="monk-form-tip">若成功上传并未应用，应点击 <label class="tipcolor">重置删除</label> 按钮，服务器会删除对应文件，节省存储空间。</div>
</div>
<div class="monk-form-item">
    <label for="Name" class="monk-form-label">系统名称</label>
    <div class="monk-form-wrap">
        <span class="monk-iconfont border-right icon-monk-input"></span>
        @Html.TextBoxFor(u => u.Name,
        new
        {
            @class = "monk-form-input normal",
            placeholder = "系统名称",
            datatype = "*1-50",
            errormsg = "系统名称由6-20位英文字母、数字或符号组成",
            nullmsg = "请输入系统名称"
        })
        <span class="monk-iconfont icon-monk-required"></span>
        <span class="monk-iconfont border-left icon-monk-dacha monk-clear-input"></span>
    </div>
    <div class="monk-form-tip">给你的系统起个牛逼的名字吧</div>
</div>
<div class="monk-form-item">
    <label for="Version" class="monk-form-label">系统版本</label>
    <div class="monk-form-wrap">
        <span class="monk-iconfont border-right icon-monk-input"></span>
        @Html.TextBoxFor(u => u.Version,
        new
        {
            @class = "monk-form-input middle",
            placeholder = "系统版本",
            datatype = "*1-25",
            errormsg = "系统版本由6-20位英文字母、数字或符号组成",
            nullmsg = "请输入系统版本"
        })
        <span class="monk-iconfont icon-monk-required"></span>
        <span class="monk-iconfont border-left icon-monk-dacha monk-clear-input"></span>
    </div>
    <div class="monk-form-tip">通常系统版本格式为：v1.0.0</div>
</div>
<div class="monk-form-item">
    <label for="Keywords" class="monk-form-label">关键字</label>
    <div class="monk-form-wrap">
        <span class="monk-iconfont border-right icon-monk-input textarea-icon"></span>
        @Html.TextAreaFor(u => u.Keywords,
        new
        {
            @class = "monk-form-textarea normal",
            placeholder = "关键字",
            datatype = "*1-100",
            ignore = "ignore",
            errormsg = "关键字由1-100位英文字母、数字或符号组成",
            nullmsg = "请输入关键字"
        })
        <span class="monk-iconfont border-left icon-monk-dacha monk-clear-input textarea-icon"></span>
    </div>
    <div class="monk-form-tip">SEO关键字，用英文逗号隔开，方法搜索引擎收录</div>
</div>
<div class="monk-form-item">
    <label for="Description" class="monk-form-label">系统描述</label>
    <div class="monk-form-wrap">
        <span class="monk-iconfont border-right icon-monk-input textarea-icon"></span>
        @Html.TextAreaFor(u => u.Description,
        new
        {
            @class = "monk-form-textarea normal",
            placeholder = "系统描述",
            datatype = "*1-160",
            ignore = "ignore",
            errormsg = "系统描述由1-160位英文字母、数字或符号组成",
            nullmsg = "请输入系统描述"
        })
        <span class="monk-iconfont border-left icon-monk-dacha monk-clear-input textarea-icon"></span>
    </div>
    <div class="monk-form-tip">简单一句话，描述一下该系统吧。</div>
</div>
<div class="monk-form-item">
    <label for="Support" class="monk-form-label">技术支持</label>
    <div class="monk-form-wrap">
        <span class="monk-iconfont border-right icon-monk-input"></span>
        @Html.TextBoxFor(u => u.Support,
        new
        {
            @class = "monk-form-input normal",
            disabled = "disabled",
            placeholder = "技术支持",
            ignore = "ignore",
            datatype = "*1-50",
            errormsg = "技术支持由6-20位英文字母、数字或符号组成",
            nullmsg = "请输入技术支持"
        })
    </div>
    <div class="monk-form-tip">毋庸置疑，只有创造她的人才更懂她~~</div>
</div>
<div class="monk-form-item">
    <label for="CopyRight" class="monk-form-label">版权所有</label>
    <div class="monk-form-wrap">
        <span class="monk-iconfont border-right icon-monk-input textarea-icon"></span>
        @Html.TextAreaFor(u => u.CopyRight,
        new
        {
            @class = "monk-form-textarea normal",
            placeholder = "版权所有",
            datatype = "*1-100",
            ignore = "ignore",
            errormsg = "版权所有由1-100位英文字母、数字或符号组成",
            nullmsg = "请输入版权所有"
        })
        <span class="monk-iconfont border-left icon-monk-dacha monk-clear-input textarea-icon"></span>
    </div>
    <div class="monk-form-tip">格式通常为：Copyright ©  2016 百签软件（中山）有限公司. All rights reserved.</div>
</div>
<div class="monk-form-item">
    <label for="Site" class="monk-form-label">官方网址</label>
    <div class="monk-form-wrap">
        <span class="monk-iconfont border-right icon-monk-input"></span>
        @Html.TextBoxFor(u => u.Site,
        new
        {
            @class = "monk-form-input normal",
            placeholder = "官方网址",
            datatype = "url",
            ignore = "ignore",
            errormsg = "请输入正确的网址",
            nullmsg = "请输入官方网址"
        })
        <span class="monk-iconfont border-left icon-monk-dacha monk-clear-input"></span>
    </div>
    <div class="monk-form-tip">写下你的官方网址，让大家多了解一下你。</div>
</div>
<div class="monk-form-item">
    <label for="PageSize" class="monk-form-label">默认页容量</label>
    <div class="monk-form-wrap">
        <span class="monk-iconfont border-right icon-monk-input"></span>
        @Html.TextBoxFor(u => u.PageSize,
        new
        {
            @class = "monk-form-input min",
            placeholder = "默认页容量",
            datatype = "n",
            errormsg = "页容量必须是正整数",
            nullmsg = "请输入默认页容量"
        })
        <span class="monk-iconfont icon-monk-required"></span>
        <span class="monk-iconfont border-left icon-monk-dacha monk-clear-input"></span>
    </div>
    <div class="monk-form-tip">指定一下默认的数据显示条数吧</div>
</div>
<div class="monk-form-item">
    <label for="ImageMaxSize" class="monk-form-label">图片最大上传大小（M）</label>
    <div class="monk-form-wrap">
        <span class="monk-iconfont border-right icon-monk-input"></span>
        @Html.TextBoxFor(u => u.ImageMaxSize,
        new
        {
            @class = "monk-form-input min",
            placeholder = "图片最大上传大小（M）",
            datatype = "n",
            errormsg = "只能输入正整数",
            nullmsg = "请输入图片最大上传大小（M）"
        })
        <span class="monk-iconfont icon-monk-required"></span>
        <span class="monk-iconfont border-left icon-monk-dacha monk-clear-input"></span>
    </div>
    <div class="monk-form-tip">指定该数值可以显示用户上传图片的大小</div>
</div>
<div class="monk-form-item">
    <label for="VideoMaxSize" class="monk-form-label">视频最大上传大小（M）</label>
    <div class="monk-form-wrap">
        <span class="monk-iconfont border-right icon-monk-input"></span>
        @Html.TextBoxFor(u => u.VideoMaxSize,
        new
        {
            @class = "monk-form-input min",
            placeholder = "视频最大上传大小（M）",
            datatype = "n",
            errormsg = "只能输入正整数",
            nullmsg = "请输入视频最大上传大小（M）"
        })
        <span class="monk-iconfont icon-monk-required"></span>
        <span class="monk-iconfont border-left icon-monk-dacha monk-clear-input"></span>
    </div>
    <div class="monk-form-tip">指定该数值可以显示用户上传视频的大小</div>
</div>
<div class="monk-form-item">
    <label for="AttachMaxSize" class="monk-form-label">附件最大上传大小（M）</label>
    <div class="monk-form-wrap">
        <span class="monk-iconfont border-right icon-monk-input"></span>
        @Html.TextBoxFor(u => u.AttachMaxSize,
        new
        {
            @class = "monk-form-input min",
            placeholder = "附件最大上传大小（M）",
            datatype = "n",
            errormsg = "只能输入正整数",
            nullmsg = "请输入附件最大上传大小（M）"
        })
        <span class="monk-iconfont icon-monk-required"></span>
        <span class="monk-iconfont border-left icon-monk-dacha monk-clear-input"></span>
    </div>
    <div class="monk-form-tip">指定该数值可以显示用户上传附件的大小</div>
</div>


@section operate{
    @Html.HiddenFor(u => u.SetID)
    <input type="submit" class="monk-input-button turquoise monk-form-submit" value="提交保存">
    <input type="reset" class="monk-input-button amethyst monk-form-reset" value="重置表单">
    <input type="button" class="monk-input-button orange monk-form-previous" value="返回前页" onclick="history.go(-1);">
}

@section endForm{@{ Html.EndForm();}}

@section foot{
    <script type="text/javascript">
        $(function () {
            var src= $("#uploadUrl").attr("data-src");
            // 图片上传
            var uploader = backend.fileUpload({
                options: {
                    fileSingleSizeLimit : @ViewBag.SysSetInfo.ImageMaxSize * 1024 * 1024
                },
                data:{
                    area:"@ViewContext.RouteData.DataTokens["area"]",
                    controller:"@ViewContext.RouteData.Values["controller"]"
                },
                fileDequeued:function(file){
                    $("#image-view").attr("src",src);
                    $("#Logo").val(src);
                },
                uploadSuccess:function(file,response){
                    $("#image-view").attr("src",response.data.path);
                    $("#Logo").val(response.data.path);
                }
            });

            backend.validform(function (data) {
                window.location.href="@Url.Action("Detail","SysSet")";
            });
        });
    </script>
}